<?php
session_start();
@$user = $_SESSION['user'];
@$zcpd = $_SESSION ['zcpd'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
	charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="web/css/bootstrap.min.css" rel="stylesheet">
<script src="web/js/jquery-1.11.1.min.js"></script>
<script src="web/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
		<script src="js/html5shiv.js"></script>
		<script src="js/respond.min.js"></script>
		<![endif]-->
<style type="text/css">
<?php if (empty($user)) {
	if (!empty($zcpd)) {?>
	.hyym { display:none;
	
	}
	
	.zym {
		display: none;
	}
	
	.zcym {
		display: block;
	}
<?php }else{ ?> 
.hyym { display:block;
	
}

.zym {
	display: none;
}

.zcym {
	display: none;
}

<?php }
} else {?> 
.hyym { display:none;
	
}

.zym {
	display: block;
}

.zcym {
	display: none;
}
<?php }?>
</style>
<script type="text/javascript">
		$.ajaxSetup({
			dataType:'JSON',
			error:function(){
				alert('执行失败');
				}
		});
		$(function() {
			$("[data-toggle='tooltip']").tooltip(); 
			$("#gb").click(function() {
				$(".panel-body").empty();
				$(".panel").load('gb.php #suo');
			});
			$("#dl").click(function() {
					$.post('dl.php',$('#form1').serialize(),function(abc){
						if(abc.zt){
							$(".hyym").css('display', 'none');
							$(".zym").css('display', 'block');
							$(".zcym").css('display', 'none');
						}else{
						alert(abc.fhwb);
						}						
					});
				});
				$("#zc1").click(function() {
					var zc="zc";
					$.post('zczt.php',{'zczt':zc},function (o){
						location.reload();
						});
				});
				$(".tc").click(function(){
					$.post('tc.php',function (){
						location.reload();
					});
				});
			});
		$(function() {
			$("#zc").click(function() {
			$.post('zc.php',$('#form2').serialize(),function(zc){
				if(zc.zt){
					alert(zc.fhwb);
				}else{
				alert(zc.fhwb);
				}						
			});
			});
			$("#cye").click(function() {
				$.post('cx.php',function(cx){
					if(cx.zt){					
						$("#ye").val(cx.ye+"元");						
					}		
				});
			});
			$("#ck").click(function() {
				var ckje=prompt('请输入存款金额:')
				$.post('ck.php',{'ck':ckje},function(ck){
						alert(ck.fhwb);					
						$("#ye").val( parseFloat(ck.ye).toFixed(2)+"元");									
				});
				});
			$("#qk").click(function() {
				var qkje=prompt('请输入取款金额:')
				$.post('qk.php',{'qk':qkje},function(qk){
						alert(qk.fhwb);					
						$("#ye").val(parseFloat(qk.ye).toFixed(2)+"元");									
				});
				});
				});
		</script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-xs-6 col-xs-offset-3">
				<div class="panel panel-primary"
					style="height: 300px; background: url(bj.jpg) no-repeat;">
					<div class="panel-heading">
						<div class="panel-title">ATM取款机</div>
					</div>
					<div class="panel-body text-center">
						<div class="hyym">
							<h3>欢迎使用ATM系统</h3>
							<h4>请选择：</h4>
							<form class="form-horizontal" id="form1">
								<div class="form-group">
									<label class="control-label col-xs-4">登录名:</label>
									<div class="col-xs-5">
										<input class="form-control" data-toggle="tooltip" data-placement="top" title="请输入帐号"
											placeholder="登录名" name="account" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-xs-4">密码:</label>
									<div class="col-xs-5">
										<input class="form-control" required="required"
											placeholder="密码" name="password" />
									</div>
								</div>
								<div class="form-group" style="padding-left: 50px">
									<button class="btn" id="dl" type="button">登录</button>
									<button class="btn" id="zc1" type="button">注册</button>
									<button class="btn" id="gb" type="button">关闭</button>
								</div>
							</form>
						</div>
						<div class="zym">
							<br />
							<br />
							<br />
							<form id="form3">
								<div class="col-xs-6 col-xs-offset-3">
									<input id="ye" name="je" class="form-control "
										required="required" placeholder="金额" />
								</div>
								<br />
								<br />
								<div>
									<button class="btn" type="button" id="cye">余额</button>
									<button class="btn" type="button" id="ck">存款</button>
									<button class="btn" type="button" id="qk">取款</button>
									<button class="btn tc" type="button">退出</button>
								</div>
							</form>
						</div>
						<div class="zcym">
							<div class="panel-heading">
								<div class="panel-lilte">
									<span class="glyphicon glyphicon-edit">
										<b>注册信息</b>
									</span>
								</div>
							</div>
							<form class="form-horizontal" id="form2">
								<div class="form-group">
									<label class="control-label col-xs-4">帐号:</label>
									<div class="col-xs-6">
										<input class="form-control" data-toggle="tooltip" data-placement="top" title="请输入注册帐号名"
											placeholder="登录名" name="zcaccount" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-xs-4">密码:</label>
									<div class="col-xs-6">
										<input class="form-control" required="required"
											placeholder="密码" name="zcpassword" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-xs-4">确认密码:</label>
									<div class="col-xs-6">
										<input class="form-control" required="required"
											placeholder="确认密码" name="qrpassword" />
									</div>
								</div>
								<div class="form-group">
									<button class="btn btn-primary  col-xs-offset-4" id="zc"
										type="button">注册</button>
									<button class="btn tc" type="button">退出</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>